using System;
using System.Collections.Generic;
using UnityEngine;

namespace Fusion.Hotfix.Editor
{
    public enum DelegateType
    {
        Action,
        Func
    }

    [Serializable]
    public class DelegateData
    {
        public List<string> data;
    }

    [Serializable]
    public class DelegateConvertorData
    {
        public DelegateType delegateType;
        public string delegateFullName;
        public List<string> data;
    }

    [Serializable]
    public class ValueTypeBinderData
    {
        public string originType;
        public string binder;
    }


    [CreateAssetMenu(fileName = "Assets/GameAssets/DLLSetting", menuName = "FusionConfig/DLL Setting")]
    public class DLLSetting : ScriptableObject
    {
        [SerializeField]
        [Tooltip("Only Folder")]
        private UnityEngine.Object[] scriptsForPack;

        [SerializeField]
        [Tooltip("DllPathList, dll in Project path.  Example: Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll")]
        private string[] additionalReferences;

        [SerializeField]
        [Tooltip(@"[ClassFullName],[AssemblyName]
Example: UnityEngine.MonoBehaviour,UnityEngine")]
        private string[] customAdapters;

        [SerializeField]
        [Tooltip(@"[ClassFullName]
Example: UnityEngine.GameObject")]
        private List<DelegateData> customMethodDelegates;

        [SerializeField]
        [Tooltip(@"[ClassFullName]
Example: UnityEngine.GameObject")]
        private List<DelegateData> customFunctionDelegates;

        [SerializeField]
        [Tooltip(@"[ClassFullName]
Example: UnityEngine.GameObject")]
        private List<DelegateConvertorData> customDelegateConvertors;

        [SerializeField]
        [Tooltip(@"[ClassFullName]
Example: UnityEngine.Vector3")]
        private List<ValueTypeBinderData> valueTypeBinders;

        [SerializeField]
        [Tooltip(@"Allow Unsafe Code")]
        private bool allowUnsafeCode = false;

        public UnityEngine.Object[] ScriptsForPack { get => scriptsForPack; }
        public string[] AdditionalReferences { get => additionalReferences; }
        public string[] CustomAdapters { get => customAdapters; }
        public List<DelegateData> CustomMethodDelegates { get => customMethodDelegates; }
        public List<DelegateData> CustomFunctionDelegates { get => customFunctionDelegates; }
        public List<DelegateConvertorData> CustomDelegateConvertors { get => customDelegateConvertors; }
        public bool AllowUnsafeCode { get => allowUnsafeCode; }
        public List<ValueTypeBinderData> ValueTypeBinders { get => valueTypeBinders; }
    }
}
